#import <Foundation/Foundation.h>
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@class YYCache, AFHTTPSessionManager;
typedef NS_ENUM(NSUInteger, PPNetworkStatus) {
    /** 未知网络*/
    PPNetworkStatusUnknown,
    /** 无网络*/
    PPNetworkStatusNotReachable,
    /** 手机网络*/
    PPNetworkStatusReachableViaWWAN,
    /** WIFI网络*/
    PPNetworkStatusReachableViaWiFi
};
typedef NS_ENUM(NSUInteger, HJCachePolicy){
    HJCachePolicyIgnoreCache = 0,
    HJCachePolicyCacheOnly = 1,
    HJCachePolicyNetworkOnly = 2,
    HJCachePolicyCacheElseNetwork = 3,
    HJCachePolicyNetworkElseCache = 4,
    HJCachePolicyCacheThenNetwork = 5
};
typedef NS_ENUM(NSUInteger, HJRequestMethod){
    HJRequestMethodGET = 0,
    HJRequestMethodPOST,
    HJRequestMethodHEAD,
    HJRequestMethodPUT,
    HJRequestMethodPATCH,
    HJRequestMethodDELETE
};
typedef NS_ENUM(NSUInteger, HJNetworkStatusType){
    HJNetworkStatusUnknown,
    HJNetworkStatusNotReachable,
    HJNetworkStatusReachableWWAN,
    HJNetworkStatusReachableWiFi
};
typedef NS_ENUM(NSUInteger, HJRequestSerializer){
    HJRequestSerializerJSON,
    HJRequestSerializerHTTP
};
typedef NS_ENUM(NSUInteger, HJResponseSerializer) {
    HJResponsetSerializerJSON,
    HJResponseSerializerHTTP
};

/** 请求成功的Block */
typedef void(^HttpRequestSuccess)(id responseObject);

/** 请求失败的Block */
typedef void(^HttpRequestFailed)(NSError *error);

/** 缓存的Block */
typedef void(^HttpRequestCache)(id responseCache);

/** 上传或者下载的进度, Progress.completedUnitCount:当前大小 - Progress.totalUnitCount:总大小*/
typedef void (^HttpProgress)(NSProgress *progress);

/** 网络状态的Block*/
typedef void(^NetworkStatus)(PPNetworkStatus status);

typedef void(^HJHttpRequest)(id responseObject, NSError *error);
typedef void(^HJHttpDownload)(NSString *path, NSError *error);
typedef void(^HJHttpProgress)(NSProgress *progress);
typedef void(^HJNetworkStatus)(HJNetworkStatusType status);
@interface PKNetTools : NSObject
+ (void)setCacheVersionEnabled:(BOOL)bFlag;
+ (void)setCacheVersion:(NSString*)version;
+ (void)setLogEnabled:(BOOL)bFlag;
+ (void)setFiltrationCacheKey:(NSArray *)filtrationCacheKey;
+ (void)setBaseURL:(NSString *)baseURL;
+ (void)setHeadr:(NSDictionary *)heder;
+ (void)setBaseParameters:(NSDictionary *)parameters;
+ (void)getNetworkStatusWithBlock:(HJNetworkStatus)networkStatus;
+ (BOOL)isNetwork;
+ (BOOL)isWWANNetwork;
+ (BOOL)isWiFiNetwork;
+ (void)cancelAllRequest;
+ (void)cancelRequestWithURL:(NSString *)url;
+ (void)setRequestTimeoutInterval:(NSTimeInterval)time;
+ (void)openNetworkActivityIndicator:(BOOL)open;
+ (void)GETWithURL:(NSString *)url
        parameters:(NSDictionary *__nullable)parameters
       cachePolicy:(HJCachePolicy)cachePolicy
           callback:(HJHttpRequest)callback;
+ (void)GETWithHeaderURL:(NSString *)url
        parameters:(NSDictionary *)parameters
       cachePolicy:(HJCachePolicy)cachePolicy
                callback:(HJHttpRequest)callback;
+ (void)POSTWithURL:(NSString *)url
         parameters:(NSDictionary * __nullable)parameters
        cachePolicy:(HJCachePolicy)cachePolicy
            callback:(HJHttpRequest)callback;
+ (void)POSTWithHeaderURL:(NSString *)url
         parameters:(NSDictionary *)parameters
        cachePolicy:(HJCachePolicy)cachePolicy
                 callback:(HJHttpRequest)callback;
+ (void)HEADWithURL:(NSString *)url
         parameters:(NSDictionary *)parameters
        cachePolicy:(HJCachePolicy)cachePolicy
            callback:(HJHttpRequest)callback;
+ (void)PUTWithURL:(NSString *)url
         parameters:(NSDictionary *)parameters
        cachePolicy:(HJCachePolicy)cachePolicy
            callback:(HJHttpRequest)callback;
+ (void)PATCHWithURL:(NSString *)url
         parameters:(NSDictionary *)parameters
        cachePolicy:(HJCachePolicy)cachePolicy
            callback:(HJHttpRequest)callback;
+ (void)DELETEWithURL:(NSString *)url
         parameters:(NSDictionary *)parameters
        cachePolicy:(HJCachePolicy)cachePolicy
            callback:(HJHttpRequest)callback;
+ (void)HTTPWithMethod:(HJRequestMethod)method
                    url:(NSString *)url
             parameters:(NSDictionary *)parameters
            cachePolicy:(HJCachePolicy)cachePolicy
                callback:(HJHttpRequest)callback;
+ (void)uploadFileWithURL:(NSString *)url
               parameters:(NSDictionary *)parameters
                     name:(NSString *)name
                 filePath:(NSString *)filePath
                 progress:(HJHttpProgress)progress
                  callback:(HJHttpRequest)callback;
+ (void)uploadImageURL:(NSString *)url
       parameters:(NSDictionary *)parameters
           images:(NSArray<UIImage *> *)images
             name:(NSString *)name
         fileName:(NSString *)fileName
         mimeType:(NSString *)mimeType
         progress:(HJHttpProgress)progress
          callback:(HJHttpRequest)callback;
+ (void)downloadWithURL:(NSString *)url
                fileDir:(NSString *)fileDir
               progress:(HJHttpProgress)progress
                callback:(HJHttpDownload)callback;
#pragma mark -- 网络缓存
+ (YYCache *)getYYCache;
+ (void)setHttpCache:(id)httpData url:(NSString *)url parameters:(NSDictionary *)parameters;
+ (void)httpCacheForURL:(NSString *)url parameters:(NSDictionary *)parameters withBlock:(void(^)(id responseObject))block;
+ (void)setCostLimit:(NSInteger)costLimit;
+ (NSInteger)getAllHttpCacheSize;
+ (void)getAllHttpCacheSizeBlock:(void(^)(NSInteger totalCount))block;
+ (void)removeAllHttpCache;
+ (void)removeAllHttpCacheBlock:(void(^)(int removedCount, int totalCount))progress
                       endBlock:(void(^)(BOOL error))end;
#pragma mark -- 重置AFHTTPSessionManager相关属性
+ (AFHTTPSessionManager *)getAFHTTPSessionManager;
+ (void)setRequestSerializer:(HJRequestSerializer)requestSerializer;
+ (void)setResponseSerializer:(HJResponseSerializer)responseSerializer;
+ (void)setValue:(NSString *)value forHTTPHeaderField:(NSString *)field;
+ (void)setSecurityPolicyWithCerPath:(NSString *)cerPath validatesDomainName:(BOOL)validatesDomainName;

+(NSString *) md5: (NSString *) inPutText;
@end
NS_ASSUME_NONNULL_END

